﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace AspNetTraining.BLL
{
   public class FunctionalityManager
    {
       public List<Functionality> GetListFunction()
       {
           using (var context = new DotNetTrainingEntities())
           {
               var func = context.Functionalities.Where(f => f.Active == true);
               return func.ToList<Functionality>();
           }
       }
       /// <summary>
       /// Return Name Function by Id
       /// </summary>
       /// <param name="ID"></param>
       /// <returns></returns>
       public String GetNameFunctionByID(System.Guid ID)
       {
           using (var context = new DotNetTrainingEntities())
           {
               var func = context.Functionalities.Where(f => f.FunctionID == ID).FirstOrDefault();
               if (func.FunctionName != null)
                   return func.FunctionName;
               else return string.Empty;
           }
       }
    }
}
